using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XFGameFramework;
using XFGameFramework.BuffSystem;
using XFGameFramework.ArchiveSystem;
using System.Data.Common;
using System;
using XFGameFramework.ScriptableObjectSystem;

public class PlayerModel : IArchiveModel, IAddableBuff
{
    #region 字段
    public int _hp;
    public int _endurance;
    #endregion
    #region 属性
    public int Hp
    {
        get { return _hp; }
        set
        {
            if (_hp != value)
            {
                OnHpChange?.Invoke(value);
            }
            _hp = value;
        }
    }
    public int Endurance
    {
        get { return _endurance; }
        set
        {
            if (_endurance != value)
            {
                OnEnduranceChange?.Invoke(value);
            }
            _endurance = value;
        }
    }
    public int Id { get; set; }
    //public PlayerConfigData playerConfigData => ScriptableObjectManager.GetConfig("PlayerConfig").GetScriptableObjectData(1) as PlayerConfigData;
    #endregion

    #region 事件
    public Action<int> OnHpChange;
    public Action<int> OnEnduranceChange;
    #endregion

    public List<BuffBase> Buffs = new List<BuffBase>();
    
    public PlayerModel()
    {
        Hp = 100;
        Endurance = 100;
    }

    #region  实现BUFF的接口
    List<BuffBase> IAddableBuff.Buffs => Buffs;
    #endregion


}
